package com.manchikanti.javacommons.util;

import java.util.Collection;
import java.util.Map;

public class NullOrEmptyCheck {

	public static boolean isNullOrEmpty(Object obj) {
		if (obj == null)
			return true;
		if (obj instanceof Collection<?>)
			return isNullOrEmpty((Collection<?>) obj);
		if (obj instanceof Map<?, ?>)
			return isNullOrEmpty((Map<?, ?>) obj);
		return obj.toString() == null || obj.toString().trim().length() == 0 ? true
				: false;
	}

	public static boolean isNullOrEmpty(Collection<?> obj) {
		return obj == null || obj.size() == 0 ? true : false;
	}

	public static boolean isNullOrEmpty(Map<?, ?> obj) {
		return obj == null || obj.size() == 0 ? true : false;
	}
	
}
